﻿using CaseManagerLibrary.Socket;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PSDClientListener.Protocols
{
    public class ListenerMessageProcessor
    {
        public MessageBase Message { get; set; }
        public static ListenerMessageProcessor Parse(MessageBase message)
        {
            string processer = "PSDClientListener.Protocols." + message.Name + "Processor";

            System.Reflection.Assembly assm = System.Reflection.Assembly.Load("PSDClientListener, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null");
            Type processerType = assm.GetType(processer);
            ListenerMessageProcessor msgProcess = (ListenerMessageProcessor)Activator.CreateInstance(processerType);
            msgProcess.Message = message;

            return msgProcess;
        }

        public virtual void Run(ClientListener context, TcpClientState state)
        {
        }
    }
}
